@push('title')
    <title>推送政策设置</title>
@endpush
@push('style2')
    <style>
        .layui-form-label {

            width: 80px;
        }
        .layui-form-item .layui-inline-padding {
            width: 78px; padding-right: 4px;
        }
        legend {
            color: #01AAED;
        }
    </style>
@endpush
@extends('layout.layer')
@section('content')
    <form class="layui-form layui-form-pane1" action="#" lay-filter="first">
        <input type="hidden" name="_token" value="{{csrf_token()}}">
        <input type="hidden" name="type" value="2">

        <div class="layui-form-item">
            <label class="layui-form-label layui-required">店铺名称</label>
            <div class="layui-input-inline">
                <select name="booking_id" lay-filter="booking-id">
                    @foreach($bookings as $value)
                        <option value="{{$value['id']}}">{{$value['name']}}</option>
                    @endforeach
                </select>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>数据来源---数据抓取来源</legend>
        </fieldset>

        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label layui-required">政策类型</label>
                <div class="layui-input-block">
                    <select name="type" lay-search="">
                        <option value="8">HUAPP</option>
                        <option value="1">特殊政策</option>
                        <option value="2">运价直连</option>
                        <option value="3">规则运价</option>
                        <option value="4">易宝</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label layui-required">数据来源</label>
                <div class="layui-input-block">
                    <select name="source_id" lay-search="">
                        <option value="8">HUAPP</option>
                        <option value="17">蜗牛数据</option>
                        <option value="21">航班管家</option>
                        <option value="24">去哪开放</option>
                        <option value="27">易宝</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label layui-required">所选产品</label>
                <div class="layui-input-block">
                    <div id="source_type" style="width: 200px;"></div>
                </div>
            </div>

        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>销售限制---航线&舱位&日期</legend>
        </fieldset>

        <div class="layui-form-item">
            <label class="layui-form-label layui-required">航司</label>
            <div class="layui-input-block">
                <div id="airline" style="width: 200px;"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">出发机场</label>
            <div class="layui-input-inline">
                <input type="text" name="depart" lay-verify="" value="" lay-reqText="出发机场" required placeholder="出发机场" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">到达机场</label>
            <div class="layui-input-inline">
                <input type="text" name="arrive" lay-verify="" value=""  lay-reqText="到达机场" required placeholder="到达机场" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">起飞日期</label>
                <div class="layui-input-block">
                    <input type="text" id="depart_at" name="depart_at" value="" lay-verify="required" readonly  lay-reqText="起飞日期" required placeholder="起飞日期" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">规则有效期</label>
                <div class="layui-input-block">
                    <input type="text" id="rule_at" name="rule_at" value="" lay-verify="required"  readonly lay-reqText="规则有效期" required placeholder="规则有效期" autocomplete="off" class="layui-input" >
                </div>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">有效航线</label>
            <div class="layui-input-block">
                <textarea type="text" name="flight_lines" class="layui-textarea"  style="width: 90%;min-height: 60px;"></textarea>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">使用航班</label>
            <div class="layui-input-block">
                <textarea type="text" name="flights" class="layui-textarea"  style="width: 90%;min-height: 60px;"></textarea>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">使用舱位</label>
            <div class="layui-input-block">
                <textarea type="text" name="cabins" class="layui-textarea"  style="width: 90%;min-height: 60px;"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">最晚提前出票时限</label>
                <div class="layui-input-block">
                    <input type="text" id="last_sale" name="last_sale" value="1" lay-verify=""  lay-reqText="天" required placeholder="天" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">最早提前出票时限</label>
                <div class="layui-input-block">
                    <input type="text" id="begin_sale" name="begin_sale" value="30" lay-verify="" lay-reqText="天" required placeholder="天" autocomplete="off" class="layui-input" >
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">销售时间限制</label>
            <div class="layui-input-block">
                <input type="text" id="sale_time_enable" name="sale_time_enable" value="" lay-verify=""  lay-reqText="多个分割,格式:0000-1000,1300-2359最多支持三段时间列表" required placeholder="多个分割,格式:0000-1000,1300-2359最多支持三段时间列表" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">起飞前禁售时间</label>
            <div class="layui-input-inline">
                <input type="text" id="last_sale_minute" name="last_sale_minute" value="120" lay-verify="" lay-reqText="分钟" required placeholder="分钟" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">起飞时间限制</label>
            <div class="layui-input-block">
                <input type="text" id="time_enable" name="time_enable" value="" lay-verify=""  lay-reqText="多个分割,格式:0000-1000,1300-2359最多支持三段时间列表" required placeholder="多个分割,格式:0000-1000,1300-2359最多支持三段时间列表" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">班期</label>
            <div class="layui-input-block">
                <input type="checkbox" name="week_enable[1]" title="周一" checked>
                <input type="checkbox" name="week_enable[2]" title="周二" checked>
                <input type="checkbox" name="week_enable[3]" title="周三" checked>
                <input type="checkbox" name="week_enable[4]" title="周四" checked>
                <input type="checkbox" name="week_enable[5]" title="周五" checked>
                <input type="checkbox" name="week_enable[6]" title="周六" checked>
                <input type="checkbox" name="week_enable[7]" title="周日" checked>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>舱位退改&库存</legend>
        </fieldset>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">票面加价</label>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="add_price" value="0" lay-verify="required" placeholder="￥" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="percentage_price" value="0" lay-verify="required" placeholder="%" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>

        <div class="layui-form-item" pane>
            <label class="layui-form-label layui-required">退票计算基准</label>
            <div class="layui-input-block">
                <input type="radio" name="refund" value="S" title="票面价">
                <input type="radio" name="refund" value="D" title="标准价">
                <input type="radio" name="refund" value="D" title="FD">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">推送最小座位数</label>
            <div class="layui-input-block">
                <input type="number" name="seat_min" value="6" lay-verify="required" min="0" lay-reqText="推送最小座位数" placeholder="推送最小座位数" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">推送最大座位数</label>
            <div class="layui-input-block">
                <input type="number" name="seat_max" value="6" lay-verify="required"  min="0"  lay-reqText="推送最大座位数" placeholder="推送最大座位数" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">库存投放数</label>
                <div class="layui-input-block">
                    <input type="number" name="stock[]" value="6" lay-verify="required" min="0"  lay-reqText="库存投放数" placeholder="库存投放数" autocomplete="off" class="layui-input" id="stock">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">座位数范围</label>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="cabin_min[]" value="1" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="cabin_max[]" value="6" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>

        <div class="layui-form-item" pane>
            <label class="layui-form-label layui-required">是否定额</label>
            <div class="layui-input-block">
                <input type="radio" name="fix" value="1" title="见舱" checked>
                <input type="radio" name="fix" value="2" title="定额">
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>让利规则</legend>
        </fieldset>

        <div class="layui-form-item" id="xc-product">
            <div class="layui-inline">
                <label class="layui-form-label">平台类型</label>
                <div class="layui-input-inline" id="product-type">
                    <select name="product_type" lay-search="" lay-filter="product-type">
                        <option value="10">恒博携程包机政策</option>
                        <option value="11">茂华携程包机政策</option>
                        <option value="20">恒博携程规则运价政策</option>
                        <option value="21">茂华携程规则运价政策</option>
                        <option value="31">恒博去哪单程政策</option>
                        <option value="30">恒博去哪单程库存政策</option>
                        <option value="36">恒博去哪分销单程政策</option>
                        <option value="40">恒博同程特殊政策</option>
<!--                        <option value="50">恒博飞猪特殊政策(非产品码)</option>-->
                        <option value="51">恒博飞猪特殊政策(产品码)</option>
                        <option value="52">恒博飞猪普通政策(产品码)</option>
                        <option value="60">恒博美团预付政策</option>
                        <option value="61">恒博美团普通政策</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">差价产品</label>
                <div class="layui-input-inline">
                    <div id="diff-price"></div>
                </div>
                <div class="layui-form-mid">差价百分比</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="diff_percentage" value="0" lay-verify="required" placeholder="%" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>

        <div class="layui-form-item product-type-item" id="qn-product-mark" style="display: none">
            <label class="layui-form-label">产品类型</label>
            <div class="layui-input-block" style="width: 700px;">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="500" title="标品 (500)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="222" title="标品-高频人群 (222)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="228" title="标品-复购特惠 (228)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="-1" title="定向套餐 (-1)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="201" title="旅行套餐 (201)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="221" title="旅行套餐-高频人群 (221)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="223" title="旅行套餐-高频年龄22-60岁 (223)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="227" title="旅行套餐-复购特惠 (227)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="280" title="机酒套餐 (280)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="894" title="早鸟套餐 (894)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="514" title="年龄特惠3-28岁 (514)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="497" title="年龄特惠12-22岁及55岁以上 (497)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="504" title="年龄特惠13-23岁及55岁以上 (504)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="501" title="年龄特惠18-22岁及55岁以上 (501)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="891" title="青年特惠13-22岁 (891)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="505" title="青年特惠18-22岁 (505)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="431" title="青年特惠18-24岁 (431)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="503" title="年龄特惠16-24岁及50岁以上 (503)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="574" title="老年特惠60-100岁 (574)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="493" title="2-9人小团 (493)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="502" title="3-9人小团 (502)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="266" title="直采产品 (266)">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="265" title="直采产品 (265)">
            </div>
        </div>

        <div class="layui-form-item product-type-item" id="mt-product-mark" style="display: none">
            <label class="layui-form-label">产品类型</label>
            <div class="layui-input-block" style="width: 700px;" >
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="0" title="普通产品" >
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="72" title="发票产品">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="786" title="代理商同舱-发票">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="787" title="代理商非同舱-发票">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="1379" title="代理商发票-婴儿儿童不适用">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="1350" title="代理商发票-仅限身份证适用">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="2255" title="代理商发票中等">
            </div>
        </div>

        <div class="layui-form-item product-type-item" id="fz-product-mark" style="display: none">
            <label class="layui-form-label">产品码</label>
            <div class="layui-input-block" style="width: 700px;">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="COMMON" title="普通产品（COMMON）" >
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="LXTC1" title="旅行套餐1（LXTC1）">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="LXTC2" title="旅行套餐2（LXTC2）">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="LXTC3" title="旅行套餐3（LXTC3）">
                <input type="checkbox" name="product_mark[]" lay-filter="productMark" value="LXTC5" title="旅行套餐5（LXTC5）">
            </div>
        </div>

        <div class="layui-form-item product-type-item" id="tc-product-mark" style="display: none">
            <label class="layui-form-label">报销类型</label>
            <div class="layui-input-block"  style="width: 700px;">
                <input type="radio" name="product_mark[]" lay-filter="productMark" value="0" title="行程单" class="layui-input">
                <input type="radio" name="product_mark[]" lay-filter="productMark" value="1" title="服务发票">
            </div>
        </div>

        <table class="layui-table" lay-skin="line" lay-filter="parse-table-demo" id="rule-table">
            <thead>
            <tr>
                <th lay-data="{checkbox:true}">乘客</th>
                <th lay-data="{field:'username', width:200}">贴钱</th>
                <th lay-data="{field:'joinTime', width:150}">贴点%</th>
                <th lay-data="{field:'joinTime', width:150}">竞价金额</th>
                <th lay-data="{field:'joinTime', width:150}">竞价比例%</th>
                <th lay-data="{field:'joinTime', width:150}">最小运价</th>
                <th lay-data="{field:'joinTime', width:150}">最大运价</th>
                <th lay-data="{field:'joinTime', width:150}">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr>
            </tr>
            <tr>
                <td><select name="rule_type[]">
                        <option value="1">成人</option>
                        <option value="2">儿童</option>
                        <option value="3">婴儿</option>
                    </select></td>
                <td> <input type="text" name="rebate_price[]" value="0" placeholder="￥" autocomplete="off" class="layui-input"></td>
                <td><input type="text" name="rebate_percentage[]" value="0" placeholder="%" autocomplete="off" class="layui-input"></td>
                <td><input type="text" name="biding_price[]" value="0" placeholder="￥" autocomplete="off" class="layui-input"></td>
                <td><input type="text" name="biding_percentage[]"  value="0" placeholder="%" autocomplete="off" class="layui-input"></td>
                <td><input type="text" name="freight_min[]"  value="0" placeholder="￥" autocomplete="off" class="layui-input"></td>
                <td><input type="text" name="freight_max[]" value="9999" placeholder="￥" autocomplete="off" class="layui-input"></td>
                <td> <a href="#" class="rule-del"> <i class="layui-icon layui-icon-delete"></i></a></td>
            </tr>
            </tbody>
        </table>
<!--        <div><a class="layui-btn layui-btn-normal rule-add" >添加让利规则</a></div>-->


        <fieldset class="layui-elem-field layui-field-title">
            <legend>验舱验价&订座</legend>
        </fieldset>

        <div class="layui-form-item">
            <label class="layui-form-label">授权Office号</label>
            <div class="layui-input-inline">
                <input type="text" id="office" name="office" value=""  lay-reqText="授权Office号" placeholder="授权Office号" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item" pane>
            <div class="layui-inline">
                <label class="layui-form-label">是否紧张过滤</label>
                <div class="layui-input-block">
                    <input type="checkbox" checked name="filter_nervous" lay-skin="switch" lay-filter="switchTest" title="ON|OFF">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">紧张过滤阈值</label>
                <div class="layui-input-block">
                    <input type="number" name="nervous_value" value="6" lay-skin="switch" lay-filter="switchTest" class="layui-input">
                </div>
            </div>
        </div>


        <fieldset class="layui-elem-field layui-field-title">
            <legend>验舱验价&订座</legend>
        </fieldset>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">证件类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="id_card" checked value="" title="不限">
                    <input type="radio" name="id_card" value="ID" title="身份证">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">儿童是否适用</label>
                <div class="layui-input-block">
                    <input type="radio" name="apply_child" checked value="T" title="是">
                    <input type="radio" name="apply_child" value="F" title="否">
                </div>
            </div>


        </div>

        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">是否验价</label>
                <div class="layui-input-block">
                    <input type="radio" name="pata" value="1" title="是">
                    <input type="radio" name="pata" checked value="0" title="否">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">验价上浮</label>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="up_float" value="0" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">验价下浮</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="down_float" value="0" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">IATA</label>
            <div class="layui-input-inline">
                <input type="text" name="iata" value="08309722" lay-skin="switch" lay-filter="switchTest" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">政策代码</label>
            <div class="layui-input-inline">
                <input type="text" name="policy_code" value="test" lay-skin="switch" lay-filter="switchTest" class="layui-input">
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>政策更新设置</legend>
        </fieldset>

        <div class="layui-form-item" pane>
            <label class="layui-form-label layui-required">政策更新方式</label>
            <div class="layui-input-block">
                <input type="radio" name="update_type" value="1" title="全量更新（全部删除后更新）">
                <input type="radio" name="update_type" value="2" title="增量更新（删除重复后更新）" checked>
            </div>
        </div>

        <div class="layui-form-item" pane>
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
@endsection
@push('script')
    <script src="/static/xml-select/xm-select.js?version={{env('JS_VERSION')}}"></script>
    <script src="/static/js/policy/policy.js?version={{env('JS_VERSION')}}"></script>
    <script>
        layui.use(['form','layer','laydate'], function() {

            var $ = layui.$
                ,form = layui.form
                ,layer = layui.layer;

            var products = [
                {name:'实名会员专享:',value:'实名会员专享:'},
                {name:'首航惠选:',value:'首航惠选:'},
                {name:'首航优选经济舱:',value:'首航优选经济舱:'},
                {name:'首航智选经济舱:',value:'首航智选经济舱:'},
                {name:'首航全价:',value:'首航全价:'},
                {name:'临近航班促销:',value:'临近航班促销:'},
                {name:'限时促销_临近航班促销:',value:'限时促销_临近航班促销:'},
                {name:'祥鹏临近航班促销:',value:'祥鹏临近航班促销:'},
                {name:'限时促销_热门打卡:',value:'限时促销_热门打卡:'},
                {name:'限时促销_移动端限时价:',value:'限时促销_移动端限时价:'},
                {name:'福航优惠经济舱_热门打卡:',value:'福航优惠经济舱_热门打卡:'},
                {name:'青老年特惠:',value:'青老年特惠:'},
                {name:'3-9人同行拼团:',value:'3-9人同行拼团:'},
                {name:'首航特惠行李:',value:'首航特惠行李:'},
                {name:'热门打卡:',value:'热门打卡:'},
                {name:'热门打卡地:',value:'热门打卡地:'},
                {name:'热门打卡地促销:',value: '热门打卡地促销:'},
                {name:'冷门打卡',value: '冷门打卡'},
                {name:'年龄专享_青年出行:',value: '年龄专享_青年出行:'},
                {name:'青年特惠:',value:'青年特惠:'},
                {name:'同行拼团:',value:'同行拼团:'},
                {name:'敬老关爱:',value:'敬老关爱:'},
                {name:'天航惠选:',value:'天航惠选:'},
                {name:'特惠行李:',value:'特惠行李:'},
                {name:'天航会员乐享:',value:'天航会员乐享:'},
                {name:'天航商旅经济:',value:'天航商旅经济:'},
                {name:'智选经济:',value:'智选经济:'},
                {name:'全价经济:',value:'全价经济:'},
                {name:'天航全价:',value:'天航全价:'},
                {name:'移动端限时价:',value:'移动端限时价:'},
                {name:'首航折扣公务:',value:'首航折扣公务:'},
                {name:'首航全价公务:',value:'首航全价公务:'},
                {name:'家庭套票3-6人:',value:'家庭套票3-6人:'},
                {name:'同行拼团3-5人:',value:'同行拼团3-5人:'},
                {name:'长者关爱:',value:'长者关爱:'},
                {name:'优享代金券（50元代金券2张）:',value:'优享代金券（50元代金券2张）:'},
                {name:'优享专车:',value:'优享专车:'},
                {name:'优享积分（额外800消费积分）:',value:'优享积分（额外800消费积分）:'},
                {name:'优享代泊:',value:'优享代泊:'},
                {name:'优享变更:',value:'优享变更:'},
                {name:'优享贵宾室:',value:'优享贵宾室:'},
                {name:'优享积分（额外1600消费积分）:',value:'优享积分（额外1600消费积分）:'},
                {name:'优享积分（额外2400消费积分）:',value:'优享积分（额外2400消费积分）:'},
                {name:'优享升舱（国内航班）:',value:'优享升舱（国内航班）:'},
                {name:'惠选经济舱:',value:'惠选经济舱:'},
                {name:'智选经济舱:',value:'智选经济舱:'},
                {name:'优选经济舱:',value:'优选经济舱:'},
                {name:'金鹏航惠选:',value:'金鹏航惠选:'},
                {name:'福航优惠经济舱:',value:'福航优惠经济舱:'},
                {name:'尊享积分（额外2400消费积分）:',value:'尊享积分（额外2400消费积分）:'},
                {name:'尊享积分（额外4800消费积分）:',value:'尊享积分（额外4800消费积分）:'},
                {name:'折扣公务舱:',value:'折扣公务舱:'},
                {name:'经典经济舱:',value:'经典经济舱:'},
                {name:'全价公务舱:',value:'全价公务舱:'},
                {name:'惠选经济舱（轻松飞）:',value:'惠选经济舱（轻松飞）:'},
                {name:'尊享专车(机场至市内接/送机服务权益一次）:',value:'尊享专车(机场至市内接/送机服务权益一次）:'},
                {name:'限时促销:',value:'限时促销:'},
                {name:'西部航经济舱:',value:'西部航经济舱:'},
                {name:'西部航特惠行李:',value:'西部航特惠行李:'},
                {name:'智选经济舱R舱:',value:'智选经济舱R舱:'},
                {name:'智选经济舱Q舱:',value:'智选经济舱Q舱:'},
                {name:'智选经济舱W舱:',value:'智选经济舱W舱:'},
                {name:'西部航优享福卡:',value:'西部航优享福卡:'},
                {name:'西部航全价经济舱:',value:'西部航全价经济舱:'},
                {name:'金鹏会员折扣直减:',value:'金鹏会员折扣直减:'},
                {name:'特惠飞:',value:'特惠飞:'},
                {name:'特惠行:',value:'特惠行:'},
                {name:'北部湾航优选经济:',value:'北部湾航优选经济:'},
                {name:'自由飞:',value:'自由飞:'},
                {name:'北部湾航智选经济:',value:'北部湾航智选经济:'},
                {name:'北部湾全价经济舱:',value:'北部湾全价经济舱:'},
                {name:'天航特惠经济:',value:'天航特惠经济:'},
                {name:'青老惠享:',value:'青老惠享:'},
                {name:'金鹏会员专享:',value:'金鹏会员专享:'},
                {name:'长安航特惠经济:',value:'长安航特惠经济:'},
                {name:'长安航智选经济舱:',value:'长安航智选经济舱:'},
                {name:'长安航全价经济:',value:'长安航全价经济:'},
                {name: '蜗牛特惠OPL14', value: 'OPL14'},
                {name: '蜗牛标品SGL1', value: 'SGL1'},
                {name: '航班管家航司直销', value: "pa"},
                {name: '基础经济舱-已减', value: "基础经济舱-已减"},

            ];

            var source_type = xmSelect.render({
                el: '#source_type',
                language: 'zn',
                name: 'source_type',
                theme: {
                    color: '#666', // 设置主题颜色
                },
                data: products
            });

            var airline = xmSelect.render({
                el: '#airline',
                language: 'zn',
                name: 'airline',
                theme: {
                    color: '#666', // 设置主题颜色
                },
                data: [
                    {name: 'CA-国航', value: 'CA'},
                    {name: 'CZ-南航', value: 'CZ'},
                    {name: 'MU-东航', value: 'MU'},
                    {name: 'HU-海航', value: 'HU'},
                    {name: 'KN-联航', value: 'KN'},
                    {name: 'SC-山东航', value: 'SC'},
                    {name: 'HO-吉祥', value: 'HO'},
                    {name: 'NS-河北航', value: 'NS'},
                    {name: 'QW-青岛航', value: 'QW'},
                    {name: 'UQ-乌航', value: 'UQ'},
                    {name: '9H-长安航', value: '9H'},
                    {name: 'GS-天津航', value: 'GS'},
                    {name: 'Y8-金鹏航空', value: 'Y8'},
                    {name: '8L-祥鹏航空', value: '8L'},
                    {name: 'MF-厦航', value: 'MF'},
                    {name: 'DZ-东海航', value: 'DZ'},
                    {name: '3U-川航', value: '3U'},
                    {name: 'ZH-深航', value: 'ZH'},
                    {name: 'JD-首都航', value: 'JD'},
                    {name: '9C-春秋航', value: '9C'},
                    {name: 'AQ-九元航', value: 'AQ'},
                    {name: 'EU-成都航', value: 'EU'},
                    {name: 'TV-西藏航', value: 'TV'},
                    {name: 'KY-昆明航', value: 'KY'},
                    {name: 'GJ-长龙航', value: 'GJ'},
                    {name: 'DR-瑞丽航', value: 'DR'},
                    {name: 'FU-福州航', value: 'FU'},
                    {name: 'RY-江西航', value: 'RY'},
                    {name: 'A6-湖南航', value: 'FU'},
                    {name: 'GX-北部湾', value: 'GX'},
                    {name: 'GY', value: 'GY'},
                    {name: 'GT', value: 'GT'},
                    {name: 'LT', value: 'LT'},
                ]
            });

            var diff_price = xmSelect.render({
                el: '#diff-price',
                language: 'zn',
                name: 'diff_price',
                theme: {
                    color: '#666', // 设置主题颜色
                },
                data: products
            });

            //监听提交
            form.on('submit(*)', function(data){

                if($('input[name=seat_min]').val() > 0) {

                    if($('#stock').val() < $('input[name=seat_min]').val()){

                        layer.msg('库存数必须 >= 推送最小座位数', {
                            offset: '15px'
                            ,icon: 5
                            ,time: 2000
                        });
                        return false;
                    }
                }

                /*if($('input[name=seat_max]').val() > 0) {

                    if($('#stock').val() > $('input[name=seat_min]').val()){

                        layer.msg('库存数必须 <= 推送最大座位数', {
                            offset: '15px'
                            ,icon: 5
                            ,time: 2000
                        });

                        return false;
                    }
                }*/

                if($('input[name=nervous_value]').val() > 0 && $('#stock').val() > 0) {

                    if($('#stock').val() < $('input[name=nervous_value]').val()){

                        layer.msg('库存数必须 >= 紧张过滤阈值', {
                            offset: '15px'
                            ,icon: 5
                            ,time: 2000
                        });

                        return false;
                    }
                }

                /*if(data.field.booking_id > 1) {

                    if (data.field.product_mark === undefined) {

                        layer.msg('请选择产品类型', {
                            offset: '15px'
                            ,icon: 5
                            ,time: 2000
                        });

                        return false;
                    }

                }*/

                $.ajax({
                    url: '/policy/ajaxAdd'
                    , method: 'post'
                    , data: data.field
                    , dataType: 'json'
                    , success: function (data) {

                        layer.msg(data.errmsg, {
                            offset: '15px'
                            ,icon: (data.errcode == 0 ? 1: 5)
                            ,time: 2000
                        }, function(){});
                    },
                });

                return false;
            });


        });
    </script>
@endpush